<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="utf-8"%>
<%@ include file="/common/init.jsp"%>
<html>
<head>
<title>澳斯浪廷会员平台</title>
<link href="<c:url value='/resources/css/css.css'/>" type="text/css" rel="stylesheet"/>
<script type="text/javascript" src="<c:url value='/resources/js/jquery-1.7.2.min.js'/>"></script>
<script type="text/javascript" src="<c:url value='/resources/js/validate.js'/>"></script>
</head>
<body leftmargin="0">
<div class="main">
<div class="width_l">
    <iframe src="menu.action" frameborder="0" width="250" height="100%" class="menu"></iframe>
</div>    
    <div class="right">
    <div class="width_r">
        <div class="menu_r">
            <ul>
                <li><a href="index.action">首页</a></li>
                <li><a href="information.action">消息</a></li>
                <li><a href="notice.action">公告中心</a></li>
                <li><a href="news.action">新闻中心</a></li>
                <li><a href="inbox.action">收件箱</a></li>
                <li><a href="tomail.action">写邮件</a></li>
                <li><a href="sent.action">已发送</a></li>
                <li><a href="${ctx}/exit.action">安全退出</a></li> 
            </ul>
        </div>
        <div class="news_top"><img src="<c:url value='/resources/images/top.jpg'/>" /></div>
        <div class="news">
          <h5>修改银行账户</h5>
            <div class="vvbt">
                <table width="840" border="0" align="center" cellpadding="0" cellspacing="0">
                  <tr>
                    <td width="120" class="vvd">国家</td>
                    <td width="120" class="vvd">省市</td>
                    <td width="150" class="vvd">开户银行</td>
                    <td width="130" class="vvd">银行户名</td>
                    <td width="220" class="vvd">银行账号</td>
                    <td width="100" class="vvd">操作</td>
                  </tr>
                </table>
          </div>
              <table width="840" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                  <td width="120" class="vvb">${userBank.bankCountry }</td>
                  <td width="120" class="vvb">${userBank.bankProvince }</td>
                  <td width="150" class="vvb">${userBank.bankName }</td>
                  <td width="130" class="vvb">
                  ${userBank.bankUser}
                  <%-- <c:choose>
                  	<c:when test="${(fn:length(userBank.bankUser))>1}">
	                  	<c:forEach begin="0" end="${fn:length(userBank.bankUser)-2}">*</c:forEach>
				    	${fn:substring(userBank.bankUser,(fn:length(userBank.bankUser)-1),fn:length(userBank.bankUser))}
                  	</c:when>
                  	<c:otherwise>
                  		${userBank.bankUser}
                  	</c:otherwise>
                  </c:choose> --%>
                  </td>
                  <td width="220" class="vvb">${userBank.bankCard }</td>
                  <td width="100" class="vvb"><a href="bankpw.action">修改</a>/删除</td>
                </tr>
              </table>
			<form id="bankpw" name="bankpw" method="post">
			<div class="bank">
			 <table width="300" border="0" align="center" cellpadding="0" cellspacing="0">
			  <tr>
			    <td width="75" align="right">户名：</td>
			    <td width="225">
			    <input type="text" id="bankUser" name="userBank.bankUser" class="text" value="${userBank.bankUser}"/><font color="red">(填写后不能再修改)</font>
			    	<%-- <c:choose>
                  	<c:when test="${(fn:length(userBank.bankUser))>1}">
	                  	<c:forEach begin="0" end="${fn:length(userBank.bankUser)-2}">*</c:forEach>
				    	${fn:substring(userBank.bankUser,(fn:length(userBank.bankUser)-1),fn:length(userBank.bankUser))}
                  	</c:when>
                  	<c:otherwise>
                  		${userBank.bankUser}
                  	</c:otherwise>
                  </c:choose> --%>
			    </td>
			  </tr>
			  <tr>
			    <td align="right">开户行：</td>
			    <td><input name="userBank.bankName" type="text" class="text" style="width:200px;" size="30" value="${userBank.bankName }" id="bankName"/></td>
			  </tr>
			  <tr>
			    <td align="right">国家：</td>
			    <td><select name="userBank.bankCountry" id="bankCountry" style="width:200px;" class="text">
						<c:forEach var="loc" items="${listCountry}">
							<option value="${loc.id.f3}" <c:if test="${userBank.bankCountry eq loc.id.f3}">selected</c:if>>${loc.id.f3 }</option>
						</c:forEach>
					</select>
				</td>
			  </tr>
			  <tr>
			    <td align="right">省/市：</td>
			    <td><input name="userBank.bankProvince" type="text" class="text" style="width:200px;" size="30" id="bankProvince" value="${userBank.bankProvince }"/></td>
			  </tr>
			  <tr>
			    <td align="right">分支行：</td>
			    <td><input name="userBank.subBranch" type="text" class="text" size="30" style="width:200px;" id="subBranch" value="${userBank.subBranch }"/></td>
			  </tr>
			  <tr>
			    <td align="right">帐号：</td>
			    <td><input name="userBank.bankCard" type="text" class="text" size="30" style="width:200px;" id="bankCard" value="${userBank.bankCard }"/></td>
			  </tr>
			  <tr>
			    <td align="right">三级密码：</td>
			    <td><input name="thirdPassword" type="password" class="text" size="30" style="width:200px;" id="thirdPassword"/></td>
			  </tr>
			</table>
          </div>
			</form>

           <div class="tijiao" onclick="doSave();"><img src="<c:url value='/resources/images/tijiao.jpg'/>" /></div>
        </div> 
        <div class="news_down"><img src="<c:url value='/resources/images/down.jpg'/>" /></div>
    </div>
    </div>
</div>

</body>
</html>
<script type="text/javascript">
function doSave(){
	$.ajaxSetup({cache:false});
	var checkFlg = true;
	checkFlg = checkFlg && validateEmpty_jquery("户名","bankUser");
	checkFlg = checkFlg && validateEmpty_jquery("开户行", "bankName");
	checkFlg = checkFlg && validateEmpty_jquery("省/市", "bankProvince");
	checkFlg = checkFlg && validateEmpty_jquery("分支行", "subBranch");
	checkFlg = checkFlg && validateEmpty_jquery("账号", "bankCard");
	
	checkFlg = checkFlg && validateEmpty_jquery("三级密码", "thirdPassword");
	//checkFlg = checkFlg && false;
	$.ajax({
		type:'POST',
		url: "${ctx}/chkTidPwd.action",
		data: "thirdPassword="+$("#thirdPassword").val(),
		dataType:"html",
        async:false,  // 设置同步方式
        cache:false,
		success: function(data,status){
			if($.trim(data)!=''){
				setValidateErrorStyle_jquery($("#thirdPassword"));
				alert(data);
				checkFlg = checkFlg && false;
			}
		},
		error: function(data,status,e){
			alert(e.name);
		}
	});
	if ( !checkFlg ) return false;
    if (checkFlg) {
    	//var data = $("#othermember").formSerialize();
    	//document.forms[0].action = "${ctx}/savebankpw.action";
        //document.forms[0].submit();
    	var data = $("#bankpw").serialize();
		jQuery.ajax({
			url: "${ctx}/savebankpw.action",
			type: "post",
			dataType:"html",
			data:data,
			async:false,
			success: function(jsondata){
				alert(jsondata);
				window.location.href = "${ctx}/bankpw.action";
			},
			error: function(XMLHttpRequest, textStatus, errorThrown) {
		    }
		});
    }
}
</script>